package com.cnbbx.cnbbx_web;

import com.cnbbx.cnbbx_web.service.UserInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

import javax.annotation.PostConstruct;

@Slf4j
@SpringBootApplication
@EnableScheduling
public class CnbbxWebApplication {
    @Autowired
    private UserInfoService userInfoService;

    public static void main(String[] args) {
        SpringApplication.run(CnbbxWebApplication.class, args);
        log.info("SpringBoot Start Success: http://localhost:8080/doc.html");
    }

    @PostConstruct
    public void init() {
        userInfoService.addUserPeriodically(); // 启动定时任务
    }
}
